#include <stdio.h>
#include <stdlib.h>


typedef struct StackNode
{
    int data;
    struct StackNode *next;
} StackNode_t, *StackNode_p;

StackNode_p createNode(int data)
{
    StackNode_p newNode = (StackNode_p)malloc(sizeof(StackNode_t));
    newNode->data = data;
    newNode->next = NULL;
    return newNode;
}

void push(StackNode_p head, int data)
{
    StackNode_p newNode = createNode(data);
    newNode->next = head->next;
    head->next = newNode;
}

void printStack(StackNode_p head)
{
    StackNode_p p = head->next;
    while (p)
    {
        printf("%d ", p->data);
        p = p->next;
    }
    printf("\n");
}

void pop(StackNode_p head)
{
    StackNode_p p = head->next;
    if (p == NULL)
    {
        return;
    }
    head->next = p->next;
    free(p);
}

int main()
{
    StackNode_p head = createNode(0);
    push(head, 11);
    push(head, 22);
    push(head, 33);
    push(head, 44);
    push(head, 55);
    printStack(head);
    pop(head);
    printStack(head);
}